<template>
  <div class="page">
    <div class="bg"></div>
    <Breadcrumbs></Breadcrumbs>
    <div class="container card">
      <Search @search="getkeyword"></Search>
      <div
        v-if="tableData.length == 0"
        style="text-align: center; margin: 41px; color: rgb(133, 132, 132)"
      >
        暂无数据
      </div>
      <div
        class="list"
        v-for="item in tableData"
        :key="item.docId"
        @click="goDetail(item)"
      >
        <img class="g_img" />
        <div class="list_info">
          <div class="list_info_title line_1">
            {{ item.bt }}
          </div>
          <div class="list_info_time">{{ item.fbrq }}</div>
          <div class="list_info_dis line_2">
            {{ item.fbt }}
          </div>
          <button>
            <span>了解更多</span> <i class="el-icon-arrow-right"></i>
          </button>
        </div>
      </div>
      <Pagination
        :page.sync="pageNum"
        :limit.sync="pageSize"
        :total="total"
        @pagination="getData"
      ></Pagination>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      pageSize: 10,
      pageNum: 1,
      total: 0,
      tableData: [],
      keyWord: "",
    };
  },
  created() {
    this.getData();
  },
  methods: {
    goDetail(row) {
      this.$router.push({
        path: "/detail",
        query: {
          docId: row.docId,
        },
      });
    },
    getData() {
      this.$api
        .docListAPI({
          pageNum: this.pageNum,
          pageSize: this.pageSize,
          cd: this.$route.name,
          keyword: this.keyWord,
        })
        .then((item) => {
          let { list, total } = item.data;
          this.tableData = list;
          this.total = total;
        });
    },
    getkeyword(e) {
      this.keyWord = e;
      this.pageNum = 1;
      this.total = 0;
      this.pageSize = 10;
      this.getData();
    },
    splitDate(date) {
      return splitDate(date);
    },
  },
};
</script>
<style scoped>
.list {
  background: #ffffff;
  display: flex;
  margin: 17px 0;
  padding: 15px;
}
.list .g_img {
  width: 345px;
  height: 214px;
  background-color: #ccc;
  flex-shrink: 0;
  margin-right: 31px;
}
.list .list_info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
}
.list .list_info .list_info_title {
  font-size: 18px;
  font-family: Source Han Sans CN, Source Han Sans CN-Bold;
  font-weight: 700;

  color: #333333;
}
.list .list_info .list_info_time {
  font-size: 12px;
  font-family: Source Han Sans CN, Source Han Sans CN-Light;
  font-weight: 300;

  color: #c4c4c4;
}
.list .list_info .list_info_dis {
  font-size: 14px;
  font-family: Source Han Sans CN, Source Han Sans CN-Light;
  font-weight: 300;

  color: #929292;
  line-height: 26px;
}
.list .list_info button {
  width: 157px;
  height: 42px;
  border: 1px solid #2959b0;
  border-radius: 22px;
  background-color: white;
  color: #2959b0;
}
.list .list_info button:hover {
  background-color: #2959b0;
  color: white;
}
.bg {
  height: 300px;
  background-image: url("@/static/img/scdc.png");
  background-repeat: no-repeat;
  background-size: cover;
}
.card {
  margin-top: 42px;
}
.page {
  background-color: #fbfbfb;
}
</style>